﻿CREATE TABLE [dbo].[Jurnale] (
    [IDJurnal]   INT           IDENTITY (1, 1) NOT NULL,
    [Denumire]   VARCHAR (100) CONSTRAINT [DF_Jurnale_Denumire] DEFAULT ('') NOT NULL,
    [IDParinte]  INT           CONSTRAINT [DF_Jurnale_IDParinte] DEFAULT (0) NOT NULL,
    [Codificare] VARCHAR (50)  CONSTRAINT [DF_Jurnale_Codificare] DEFAULT ('') NOT NULL,
    [Terminal]   BIT           CONSTRAINT [DF_Jurnale_Terminal] DEFAULT (1) NOT NULL,
    [CodUnitate] SMALLINT      CONSTRAINT [DF_Jurnale_CodUnitate] DEFAULT ((0)) NOT NULL,
    [IBAN]       VARCHAR (24)  NULL,
    [IDBanca]    SMALLINT      NULL,
    CONSTRAINT [PK_Jurnale] PRIMARY KEY CLUSTERED ([IDJurnal] ASC) WITH (FILLFACTOR = 90),
    CONSTRAINT [FK_Jurnale_Banci] FOREIGN KEY ([IDBanca]) REFERENCES [dbo].[Banci] ([IdBanca]),
    CONSTRAINT [FK_Jurnale_Jurnale] FOREIGN KEY ([IDParinte]) REFERENCES [dbo].[Jurnale] ([IDJurnal]),
    CONSTRAINT [FK_Jurnale_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate])
);


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Daca se poate scrie in el, sau doar insumeaza', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Jurnale', @level2type = N'COLUMN', @level2name = N'Terminal';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Codificare externa', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Jurnale', @level2type = N'COLUMN', @level2name = N'Codificare';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Id-ul jurnalului parinte', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Jurnale', @level2type = N'COLUMN', @level2name = N'IDParinte';


GO
EXECUTE sp_addextendedproperty @name = N'MS_Description', @value = N'Denumirea jurnalului', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'TABLE', @level1name = N'Jurnale', @level2type = N'COLUMN', @level2name = N'Denumire';

